package com.clickpaas.materialsprocurement.controller;

import com.clickpaas.materialsprocurement.annotation.ControllerLog;
import com.clickpaas.materialsprocurement.common.Response.ResponseResult;
import com.clickpaas.materialsprocurement.service.ControllerService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@Api(description = "数据保存")
@RestController
@RequestMapping(value = "/insert")
public class InsertMaterialShopCartController {
    @Resource
    ControllerService controllerService;

    @ApiOperation("采购订单行数据入库")
    @PostMapping(value = "/insertPurchaseOrderLine")
    @ControllerLog
    public ResponseResult insertPurchaseOrderLineInfo(@ApiParam(value = "PurchaseOrderLineEntity Of Json")@RequestBody String  json) {
        return controllerService.insertPurchaseOrderLineInfo(json);
    }

    @ApiOperation("共享库存数据入库")
    @PostMapping(value = "/insertShareInvent")
    @ControllerLog
    public ResponseResult insertShareInventInfo(@ApiParam(value = "SharedInventEntity Of Json") @RequestBody String json) {
        return controllerService.insertShareInventInfo(json);
    }

    @ApiOperation("甄选对象数据入库")
    @PostMapping(value = "/insertSelection")
    @ControllerLog
    public ResponseResult insertSelectionInfo(@ApiParam(value = "SrmSelectEntity Of Json") @RequestBody String json) {
        return controllerService.insertSelectionInfo(json);
    }

    @ApiOperation("物料资料对象数据入库")
    @PostMapping(value = "/insertMateriel")
    @ControllerLog
    public ResponseResult insertMaterielInfo(@ApiParam(value = "MaterialsEntity Of Json") @RequestBody String json) {
        return controllerService.insertMaterielInfo(json);
    }

    @ApiOperation("写入入库单对象数据")
    @PostMapping(value = "/insertStockInOrder")
    @ControllerLog
    public ResponseResult insertStockInOrderInfo(@ApiParam(value = "StockInOrderEntity Of Json") @RequestBody String json) {
        return controllerService.insertStockInOrderInfo(json);
    }
}
